package com.cluck.pay.enums;

import com.lly835.bestpay.enums.BestPayTypeEnum;
import lombok.Data;
import lombok.Getter;

/**
 * 支付类型
 * @author cluck
 * @version 1.0
 * @date 2020/5/11 16:11
 */
@Getter
public enum PayPlatformEnum {
    //1-支付宝，2-微信
    ALIPAY(1),

    WX(2),
    ;

    Integer code;

    PayPlatformEnum(Integer code) {
        this.code = code;
    }

    /**
     * 获取支付类型
     * @param bestPayTypeEnum
     * @return
     */
    public static PayPlatformEnum getByBestPayTypeEnum(BestPayTypeEnum bestPayTypeEnum) {
        for(PayPlatformEnum payPlatformEnum : PayPlatformEnum.values()) {
            if(bestPayTypeEnum.getPlatform().name().equals(payPlatformEnum.name())) {
                return payPlatformEnum;
            }
        }
        throw new RuntimeException("错误支付平台:" + bestPayTypeEnum.name());
    }
}
